package com.yzl;

import com.yzl.builder.Computer;
import com.yzl.builder.Director;
import com.yzl.builder.LowComputerBuilder;
import com.yzl.factory.Pay;
import com.yzl.factory.abs.FactoryProducer;
import com.yzl.factory.abs.OrderFactory;
import com.yzl.factory.method.AliPayFactory;
import com.yzl.factory.method.PayFactory;
import com.yzl.factory.method.WechatFactory;
import com.yzl.factory.simple.SimplePayFactory;
import com.yzl.prototype.Person;

/**
 * @program: design-pattern
 * @description: 启动类
 * @author: YaoZhiLi
 * @create: 2021-08-01 20:58
 */
public class Main {
    public static void main(String[] args) {
//        单例懒汉
//        SingletonLazy.getInstance().process();
//        单例饿汉
//        SingletonHungry.getInstance().process();

//        简单工厂
//        Pay pay = SimplePayFactory.createPay("WECHAT PAY");
//        pay.unifiedorder();

//        工厂方法模式
//        PayFactory aliPayFactory = new AliPayFactory();
//        Pay aliPay = aliPayFactory.getPay();
//        aliPay.unifiedorder();
//        WechatFactory wechatFactory = new WechatFactory();
//        Pay wechatPay = wechatFactory.getPay();
//        wechatPay.unifiedorder();

//        OrderFactory orderFactory = FactoryProducer.getFactory("Ali PAY");
//        orderFactory.createPay().unifiedorder();
//        orderFactory.createRefund().refund();

        Director director = new Director();
        Computer computer = director.create(new LowComputerBuilder());
        System.out.println(computer);
    }
}